home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / amigaunits / colorwheel.pas < prev    next >
Pascal/Delphi Source File  |  2000-01-01  |  3KB  |  100 lines

  1. {
  2.     This file is part of the Free Pascal run time library.
  3.  
  4.     A file in Amiga system run time library.
  5.     Copyright (c) 1998-200 by Nils Sjoholm
  6.     member of the Amiga RTL development team.
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15.  **********************************************************************}
  16.  
  17.  
  18. UNIT colorwhell;
  19.  
  20. INTERFACE
  21. USES exec, utility;
  22.  
  23. Type
  24. { For use with the WHEEL_HSB tag }
  25.  pColorWheelHSB = ^tColorWheelHSB;
  26.  tColorWheelHSB = record
  27.     cw_Hue,
  28.     cw_Saturation,
  29.     cw_Brightness  : ULONG;
  30.  end;
  31.  
  32. { For use with the WHEEL_RGB tag }
  33.  pColorWheelRGB = ^tColorWheelRGB;
  34.  tColorWheelRGB = record
  35.     cw_Red,
  36.     cw_Green,
  37.     cw_Blue  : ULONG;
  38.  end;
  39.  
  40.  
  41. {***************************************************************************}
  42.  
  43. const
  44.     WHEEL_Dummy          = (TAG_USER+$04000000);
  45.     WHEEL_Hue            = (WHEEL_Dummy+1) ;  { set/get Hue              }
  46.     WHEEL_Saturation     = (WHEEL_Dummy+2) ;  { set/get Saturation        }
  47.     WHEEL_Brightness     = (WHEEL_Dummy+3) ;  { set/get Brightness        }
  48.     WHEEL_HSB            = (WHEEL_Dummy+4) ;  { set/get ColorWheelHSB     }
  49.     WHEEL_Red            = (WHEEL_Dummy+5) ;  { set/get Red               }
  50.     WHEEL_Green          = (WHEEL_Dummy+6) ;  { set/get Green     }
  51.     WHEEL_Blue           = (WHEEL_Dummy+7) ;  { set/get Blue              }
  52.     WHEEL_RGB            = (WHEEL_Dummy+8) ;  { set/get ColorWheelRGB     }
  53.     WHEEL_Screen         = (WHEEL_Dummy+9) ;  { init screen/enviroment    }
  54.     WHEEL_Abbrv          = (WHEEL_Dummy+10);  { "GCBMRY" if English       }
  55.     WHEEL_Donation       = (WHEEL_Dummy+11);  { colors donated by app     }
  56.     WHEEL_BevelBox       = (WHEEL_Dummy+12);  { inside a bevel box        }
  57.     WHEEL_GradientSlider = (WHEEL_Dummy+13);  { attached gradient slider  }
  58.     WHEEL_MaxPens        = (WHEEL_Dummy+14);  { max # of pens to allocate }
  59.  
  60.  
  61. {***************************************************************************}
  62.  
  63. {--- functions in V39 or higher (Release 3) ---}
  64.  
  65. VAR ColorWheelBase : pLibrary;
  66.  
  67. PROCEDURE ConvertHSBToRGB(hsb : pColorWheelHSB; rgb : pColorWheelRGB);
  68. PROCEDURE ConvertRGBToHSB(rgb : pColorWheelRGB; hsb : pColorWheelHSB);
  69.  
  70. IMPLEMENTATION
  71.  
  72. PROCEDURE ConvertHSBToRGB(hsb : pColorWheelHSB; rgb : pColorWheelRGB);
  73. BEGIN
  74.   ASM
  75.     MOVE.L  A6,-(A7)
  76.     MOVEA.L hsb,A0
  77.     MOVEA.L rgb,A1
  78.     MOVEA.L ColorWheelBase,A6
  79.     JSR -030(A6)
  80.     MOVEA.L (A7)+,A6
  81.   END;
  82. END;
  83.  
  84. PROCEDURE ConvertRGBToHSB(rgb : pColorWheelRGB; hsb : pColorWheelHSB);
  85. BEGIN
  86.   ASM
  87.     MOVE.L  A6,-(A7)
  88.     MOVEA.L rgb,A0
  89.     MOVEA.L hsb,A1
  90.     MOVEA.L ColorWheelBase,A6
  91.     JSR -036(A6)
  92.     MOVEA.L (A7)+,A6
  93.   END;
  94. END;
  95.  
  96. END. (* UNIT COLORWHEEL *)
  97.  
  98.  
  99.  
  100.